import { modelCategoriesGetter } from "@/service/methods/feed";
import { useRequest } from "alova";
import { defineStore } from "pinia";

export const useModelCategory = defineStore('ModelCategory',()=>{
  const {loading, data} = useRequest(modelCategoriesGetter())
  const getCategory = (code?:string)=>{
    if (!data || !data.value.length) return
    return data.value.find(item=>item.category_code === code)
  }
  return {loading, data, getCategory}
})